One of the presets has "h264 in MP4" that already has all the options to
create such a file. If you want to render animations for platforms such as
YouTube, an MP4 file with h264 is a great choice.
You might want to change a few details about the video to tweak the
quality. For instance, change the Output quality from "Medium quality" to
"High quality" to get much better quality for animation rendering. Those
settings will improve aspects like video bitrate.
That keeps your video file with the highest possible quality and will most
likely generate a large file. In the audio field, you will notice that it shows
the option "No audio." Because our animation's frames from the 3D
Viewport doesn't feature any audio, you should keep the option as "No
audio" (Figure 8.12).
Figure 8.12 - Video encoding
You can add audio for any animation later in the Video Sequencer Editor
and use those settings to control both format and quality for any audio
data.